package cn.jingzhuan.fm.pojo

import android.os.Parcel
import android.os.Parcelable
import com.google.gson.annotations.SerializedName


data class FMAlbum(
        @SerializedName("id") val id: String,
        @SerializedName("name") val name: String,
        @SerializedName("logo_url") val logoUrl: String,
        @SerializedName("simple_description") val simpleDescription: String,
        @SerializedName("description") val description: String?,
        @SerializedName("suit_crowd") val suitCrowd: String,
        @SerializedName("category_id") val categoryId: String?,
        @SerializedName("category_name") val categoryName: String?,
        @SerializedName("listen_count") val listenCount: String,
        @SerializedName("audio_count") val audioCount: String,
        @SerializedName("update_date") val updateDate: String,
        @SerializedName("created_at") val createdAt: String,
        @SerializedName("status") val status: String
) : Parcelable {
    constructor(source: Parcel) : this(
            source.readString(),
            source.readString(),
            source.readString(),
            source.readString(),
            source.readString(),
            source.readString(),
            source.readString(),
            source.readString(),
            source.readString(),
            source.readString(),
            source.readString(),
            source.readString(),
            source.readString()
    )

    override fun describeContents() = 0

    override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) {
        writeString(id)
        writeString(name)
        writeString(logoUrl)
        writeString(simpleDescription)
        writeString(description)
        writeString(suitCrowd)
        writeString(categoryId)
        writeString(categoryName)
        writeString(listenCount)
        writeString(audioCount)
        writeString(updateDate)
        writeString(createdAt)
        writeString(status)
    }

    companion object {
        @JvmField
        val CREATOR: Parcelable.Creator<FMAlbum> = object : Parcelable.Creator<FMAlbum> {
            override fun createFromParcel(source: Parcel): FMAlbum = FMAlbum(source)
            override fun newArray(size: Int): Array<FMAlbum?> = arrayOfNulls(size)
        }
    }
}